(function (lib, config) {
    /**/
    var loadFunc = function () {
        var wordAry = config.words.split('|'), bgcolorAry = config.bgcolor.split('|').textcolorAry = config.textcolor.split('|');
        var _ua = navigator.userAgent, _ua_text = false, _position = "fixed";
        if (config.iscomapp && _ua.indexOf('baiduboxapp') > -1) {
            _ua_text = true;
            _position = "absolute";
        }
        /*TODO 方法*/
        var htmlStr = [
            '<style type="text/css">',
            ' .swt_righthot{width:65px;position:fixed;right:-50px;top:16%;z-index:9999;-webkit-animation:swing 1s 1s ease both;animation:swing 1s 1s ease both;-webkit-transition:all 1s ease-in-out;transition:all 1s ease-in-out;opacity:0}',
            '    .swt_righthot.animate{right:0;opacity:1}',
            '    .swt_righthot.animate1{-webkit-animation:tops 15s infinite;animation:tops 15s infinite}',
            '    .swt_leftzx{width:65px;position:fixed;right:-50px;top:16%;z-index:9999;-webkit-animation:swing 1s 1s ease both;animation:swing 1s 1s ease both;-webkit-transition:all 1s ease-in-out;transition:all 1s ease-in-out;opacity:0}',
            '    .swt_leftzx.animate{right:0;opacity:1}',
            '    @-webkit-keyframes swing{0%{-webkit-transform:translateX(0)}',
            '        15%{-webkit-transform:translateX(-2%) rotate(-2deg)}',
            '        30%{-webkit-transform:translateX(2%) rotate(2deg)}',
            '        45%{-webkit-transform:translateX(-2%) rotate(-2deg)}',
            '        60%{-webkit-transform:translateX(2%) rotate(2deg)}',
            '        75%{-webkit-transform:translateX(-2%) rotate(-2deg)}',
            '        100%{-webkit-transform:translateX(0)}',
            '    }',
            '    @-webkit-keyframes sc{0%{-webkit-transform:scale(1);top:45%;left:50%}',
            '        100%{-webkit-transform:scale(0);top:105%;left:15%}',
            '    }',
            '    @-webkit-keyframes cs{0%{-webkit-transform:scale(0);top:105%;left:15%}',
            '        100%{-webkit-transform:scale(1);top:45%;left:50%}',
            '    }',
            '    @-webkit-keyframes swing{0%{-webkit-transform:translateX(0)}',
            '        15%{-webkit-transform:translateX(-2%) rotate(-2deg)}',
            '        30%{-webkit-transform:translateX(2%) rotate(2deg)}',
            '        45%{-webkit-transform:translateX(-2%) rotate(-2deg)}',
            '        60%{-webkit-transform:translateX(2%) rotate(2deg)}',
            '        75%{-webkit-transform:translateX(-2%) rotate(-2deg)}',
            '        100%{-webkit-transform:translateX(0)}',
            '    }',
            '    @-moz-keyframes swing{0%{-webkit-transform:translateX(0)}',
            '        15%{-webkit-transform:translateX(-2%) rotate(-2deg)}',
            '        30%{-webkit-transform:translateX(2%) rotate(2deg)}',
            '        45%{-webkit-transform:translateX(-2%) rotate(-2deg)}',
            '        60%{-webkit-transform:translateX(2%) rotate(2deg)}',
            '        75%{-webkit-transform:translateX(-2%) rotate(-2deg)}',
            '        100%{-webkit-transform:translateX(0)}',
            '    }',
            '    @-ms-keyframes swing{0%{-webkit-transform:translateX(0)}',
            '        15%{-webkit-transform:translateX(-2%) rotate(-2deg)}',
            '        30%{-webkit-transform:translateX(2%) rotate(2deg)}',
            '        45%{-webkit-transform:translateX(-2%) rotate(-2deg)}',
            '        60%{-webkit-transform:translateX(2%) rotate(2deg)}',
            '        75%{-webkit-transform:translateX(-2%) rotate(-2deg)}',
            '        100%{-webkit-transform:translateX(0)}',
            '    }',
            '    @-o-keyframes swing{0%{-webkit-transform:translateX(0)}',
            '        15%{-webkit-transform:translateX(-2%) rotate(-2deg)}',
            '        30%{-webkit-transform:translateX(2%) rotate(2deg)}',
            '        45%{-webkit-transform:translateX(-2%) rotate(-2deg)}',
            '        60%{-webkit-transform:translateX(2%) rotate(2deg)}',
            '        75%{-webkit-transform:translateX(-2%) rotate(-2deg)}',
            '        100%{-webkit-transform:translateX(0)}',
            '    }',
            '    @-webkit-keyframes tops{0%{top:16%}',
            '        50%{top:50%}',
            '        100%{top:16%}',
            '    }',
            '    @-moz-keyframes tops{0%{top:16%}',
            '        50%{top:50%}',
            '        100%{top:16%}',
            '    }',
            '    @-ms-keyframes tops{0%{top:16%}',
            '        50%{top:50%}',
            '        100%{top:16%}',
            '    }',
            '    @-o-keyframes tops{0%{top:16%}',
            '        50%{top:50%}',
            '        100%{top:16%}',
            '    }',
            '    .animated{-webkit-animation-duration:1s;animation-duration:1s;-webkit-animation-fill-mode:both;animation-fill-mode:both}',
            '    @-webkit-keyframes fadeInDown{0%{-webkit-transform:translate3d(0,-300%,0);transform:translate3d(0,-300%,0)}',
            '        50%{-webkit-transform:rotate(3deg);transform:rotate(3deg)}',
            '        100%{-webkit-transform:none;transform:none}',
            '    }',
            '    @keyframes fadeInDown{0%{-webkit-transform:translate3d(0,-300%,0);transform:translate3d(0,-300%,0)}',
            '        50%{-webkit-transform:rotate(3deg);transform:rotate(3deg)}',
            '        100%{-webkit-transform:none;transform:none}',
            '    }',
            '    .fadeInDown{-webkit-animation-name:fadeInDown;animation-name:fadeInDown}',
            '    @-webkit-keyframes fadeOutDown{50%{-webkit-transform:rotate(-5deg);transform:rotate(-5deg)}',
            '        80%{-webkit-transform:translate3d(0,300%,0);transform:translate3d(0,300%,0)}',
            '    }',
            '    @keyframes fadeOutDown{50%{-webkit-transform:rotate(-5deg);transform:rotate(-5deg)}',
            '        80%{-webkit-transform:translate3d(0,300%,0);transform:translate3d(0,300%,0)}',
            '    }',
            '    .fadeOutDown{-webkit-animation-name:fadeOutDown;animation-name:fadeOutDown}',
            '	@-webkit-keyframes fadeout{',
            '    0%{opacity:1;}',
            '    100%{opacity:0;}',
            '}',
            '@-moz-keyframes fadeout{',
            '    0%{opacity:1;}',
            '    100%{opacity:0;}',
            '}',
            '@-ms-keyframes fadeout{',
            '    0%{opacity:1;}',
            '    100%{opacity:0;}',
            '}',
            '@keyframes fadeout{',
            '    0%{opacity:1;}',
            '    100%{opacity:0;',
            '	',
            '	}',
            '}',
            '    #zjswt{left:50%;width:257px;height:218px;z-index:99999999;display:none;margin-left:-128.5px;margin-top:-109px}',
            '    .swt_zjnr{width:257px;height:218px;overflow:hidden;background:url(http://nkm.6660333.cn/images/swt_zjtc.png) no-repeat center top;background-size:257px 218px}',
            '    .swt_zjnr a{width:257px;height:218px;display:block}',
            '    #swt_righty{position:fixed;bottom:8%;right:0}',
            '    @media screen and (max-width:479px) and (min-width:319px){#zjswt{width:214px;height:181px;margin-left:-107px;margin-top:-90.5px}',
            '        .swt_zjnr{width:214px;height:181px;background-size:214px 181px}',
            '        .swt_zjnr a{width:214px;height:181px}',
            '        .swt_leftzx{width:32px}',
            '        .swt_righthot{width:43px}',
            '        #swt_righty{width:21%}',
            '    }',
            '</style>',
            '<div id="zjswt" class="animated fadeInDown" style="top: 50%;">',
            '    <div style="position:relative; z-index:0;">',
            '        <div class="swt_zjnr" >',
            '            <a href="javascript:void(0);" onclick="openZoosUrl(\'{{identifier}}\')"></a>',
            '            <div style="width:100%;height:23%;position: absolute;bottom: 0;"><a style="width:50%;float: left;height: 100%;"  href="javascript:void(0);" onClick="openZoosUrl(\'{{identifier}}\');"></a><a style="width:50%;float: left;height: 100%;" href="{{weblink}}"></a></div>',
            '        </div>',
            '        <div style="width: 40px;height:40px; position: absolute;right: 0;top:0;background:none;z-index: 10002;" onclick="popCancel()" class="swt_zjnr_n"></div>',
            '    </div>',
            '</div>'
        ].join('');
        htmlStr = lib.util.resolveTemplate(htmlStr, 'identifier', config.identifier,'weblink',config.weblink);
        document.getElementsByTagName('body')[0].innerHTML += htmlStr;
        var zjswt = document.getElementById('zjswt');
         window.popCancel=function() {
            zjswt.style.display = 'none';
            if (+config.relapsetime>0)setTimeout(op, config.relapsetime * 1000);
        }
        zjswt.style.position = _position;
        if (_ua_text) {
            var _t_zjswt = zjswt.style.top;
            if (_t_zjswt == '') {
                _t_zjswt = 0;
            }
            lib.util.addEvent(window, 'scroll', function () {
                zjswt.style.top = parseInt(_t_zjswt) + (getScrollTop() / getClientHeight()) * 100 + '%';
            });
        }
        function op() {
            /* $("#zjswt").show().removeClass("fadeOutDown").addClass("fadeInDown"); */
            zjswt.style.display = "block";
        }
        setTimeout(op, config.firsttime * 1000);
    };
    lib.load(loadFunc);
    /*执行代码*/
})('{{lib}}', '{{config}}');